<HTML><HEAD>
<TITLE>netwib doc_html (version 5.39.0)</TITLE>
</HEAD><BODY BGCOLOR="#FFFFFF" TEXT="#000000">
<H2><A HREF="../../index.html">main index</A></H2>
<H2><A HREF="../net.html">section index</A></H2><HR><BR>
<PRE>

<FONT COLOR="#880000">/*-------------------------------------------------------------*/</FONT>
<FONT COLOR="#880000"><B>/***************************************************************
 * An Ethernet range is of the form :                          *
 *                                    ethinf       ethsup      *
 *   a:b:c:d:e:f                  : a:b:c:d:e:f  a:b:c:d:e:f   *
 *   a:b:c:d:e:f-a:b:c:d:f:f      : a:b:c:d:e:f  a:b:c:d:f:f   *
 *   a:b:c:d:e:0/40               : a:b:c:d:e:0  a:b:c:d:e:f   *
 *   a:b:c:d:e:0%40               : a:b:c:d:e:1  a:b:c:d:e:e   *
 *   a:b:c:d:e:0/ff:ff:ff:ff:ff:0 : a:b:c:d:e:0  a:b:c:d:e:f   *
 * Notes :                                                     *
 *  - '%' has the same meaning as '/', except that the         *
 *    broadcast addresses are excluded from range.             *
 *                                                             *
 * A <FONT COLOR="#000088">netwib_eths</FONT> is of the form :                              *
 *   eth,eth,ethrange,ethrange                                 *
 *   all,!eth,!ethrange                                        *
 *                                                             *
 * Complete examples :                                         *
 *   a:b:c:d:e:f                                               *
 *   a:b:c:d:e:f-a:b:c:d:f:f                                   *
 *   a:b:c:d:e:f,a:b:c:d:f:f                                   *
 *   1:2:3:4:5:6,a:b:c:d:e:f-a:b:c:d:f:f                       *
 *   all,!1:2:3:4:5:6,!a:b:c:d:e:f-a:b:c:d:f:f                 *
 ***************************************************************/</B></FONT>

<FONT COLOR="#880000">/*-------------------------------------------------------------*/</FONT>
<FONT COLOR="#880000"><B>/***************************************************************
 * Those functions ignores following error cases :             *
 *  - if we try to add a value already in the list             *
 *  - if we try to remove a value not in the list              *
 ***************************************************************/</B></FONT>

<FONT COLOR="#880000">/*-------------------------------------------------------------*/</FONT>
typedef struct <FONT COLOR="#000088">netwib_eths</FONT> <FONT COLOR="#000088">netwib_eths</FONT>;
typedef const <FONT COLOR="#000088">netwib_eths</FONT> <FONT COLOR="#000088">netwib_consteths</FONT>;

<FONT COLOR="#880000">/*-------------------------------------------------------------*/</FONT>
<FONT COLOR="#880000">/* Name : netwib_eths_init
   Description :
     Initialize a <FONT COLOR="#000088">netwib_eths</FONT> used to store several Ethernet
     addresses.
   Input parameter(s) :
     inittype : if future added items will be sorted and/or unique
   Input/output parameter(s) :
   Output parameter(s) :
     **ppeths : <FONT COLOR="#000088">netwib_eths</FONT> allocated and initialized
   Normal return values :
     <FONT COLOR="#000044">NETWIB_ERR_OK</FONT> : ok
*/</FONT>
typedef enum {
  <FONT COLOR="#000044">NETWIB_ETHS_INITTYPE_SORTUNIQ</FONT> = 1, <FONT COLOR="#880000">/* sorted and unique */</FONT>
  <FONT COLOR="#000044">NETWIB_ETHS_INITTYPE_NOTSORTUNIQ</FONT> = 2, <FONT COLOR="#880000">/* not sorted and unique */</FONT>
  <FONT COLOR="#000044">NETWIB_ETHS_INITTYPE_NOTSORTNOTUNIQ</FONT> = 3 <FONT COLOR="#880000">/* not sorted and not
                                             unique (duplicates
                                             are not removed) */</FONT>
} <FONT COLOR="#000088">netwib_eths_inittype</FONT>;
<FONT COLOR="#000088">netwib_err</FONT> <B>netwib_eths_init</B>(<FONT COLOR="#000088">netwib_eths_inittype</FONT> inittype,
                            <FONT COLOR="#000088">netwib_eths</FONT> **ppeths);
<FONT COLOR="#008800">#define <B>netwib_eths_initdefault</B>(ppeths) <B>netwib_eths_init</B>(<FONT COLOR="#000044">NETWIB_ETHS_INITTYPE_SORTUNIQ</FONT>,ppeths)</FONT>

<FONT COLOR="#880000">/*-------------------------------------------------------------*/</FONT>
<FONT COLOR="#880000">/* Name : netwib_eths_close
   Description :
     Close a netwib_eths.
   Input parameter(s) :
   Input/output parameter(s) :
     **ppeths : <FONT COLOR="#000088">netwib_eths</FONT> closed
   Output parameter(s) :
   Normal return values :
     <FONT COLOR="#000044">NETWIB_ERR_OK</FONT> : ok
*/</FONT>
<FONT COLOR="#000088">netwib_err</FONT> <B>netwib_eths_close</B>(<FONT COLOR="#000088">netwib_eths</FONT> **ppeths);

<FONT COLOR="#880000">/*-------------------------------------------------------------*/</FONT>
<FONT COLOR="#880000">/* Name : netwib_eths_add_eth
   Description :
     Add an address to the netwib_eths.
   Input parameter(s) :
     eth : address to add
   Input/output parameter(s) :
     *peths : <FONT COLOR="#000088">netwib_eths</FONT> where to work
   Output parameter(s) :
   Normal return values :
     <FONT COLOR="#000044">NETWIB_ERR_OK</FONT> : ok
*/</FONT>
<FONT COLOR="#000088">netwib_err</FONT> <B>netwib_eths_add_eth</B>(<FONT COLOR="#000088">netwib_eths</FONT> *peths,
                               <FONT COLOR="#000088">netwib_consteth</FONT> *peth);

<FONT COLOR="#880000">/*-------------------------------------------------------------*/</FONT>
<FONT COLOR="#880000">/* Name : netwib_eths_add_ethrange
   Description :
     Add a range of addresses to the netwib_eths.
   Input parameter(s) :
     infeth : inferior eth
     supeth : superior eth
   Input/output parameter(s) :
     *peths : <FONT COLOR="#000088">netwib_eths</FONT> where to work
   Output parameter(s) :
   Normal return values :
     <FONT COLOR="#000044">NETWIB_ERR_OK</FONT> : ok
*/</FONT>
<FONT COLOR="#000088">netwib_err</FONT> <B>netwib_eths_add_ethrange</B>(<FONT COLOR="#000088">netwib_eths</FONT> *peths,
                                    <FONT COLOR="#000088">netwib_consteth</FONT> *pinfeth,
                                    <FONT COLOR="#000088">netwib_consteth</FONT> *psupeth);

<FONT COLOR="#880000">/*-------------------------------------------------------------*/</FONT>
<FONT COLOR="#880000">/* Name : netwib_eths_add_eths
   Description :
     Add a list of addresses to the netwib_eths.
   Input parameter(s) :
     *pethstoadd : <FONT COLOR="#000088">netwib_eths</FONT> to add
   Input/output parameter(s) :
     *peths : <FONT COLOR="#000088">netwib_eths</FONT> where to work
   Output parameter(s) :
   Normal return values :
     <FONT COLOR="#000044">NETWIB_ERR_OK</FONT> : ok
   Note :
     If an error occurs during insertion, result will only
     contain partial data. It's developer's job to use a
     temporary <FONT COLOR="#000088">netwib_eths</FONT> to deal with such errors.
*/</FONT>
<FONT COLOR="#000088">netwib_err</FONT> <B>netwib_eths_add_eths</B>(<FONT COLOR="#000088">netwib_eths</FONT> *peths,
                                <FONT COLOR="#000088">netwib_consteths</FONT> *pethstoadd);

<FONT COLOR="#880000">/*-------------------------------------------------------------*/</FONT>
<FONT COLOR="#880000">/* Name : netwib_eths_add_buf
   Description :
     Add a list represented as a string like
     "aa:bb:cc:dd:ee:ff-aa:bb:cc:dd:ff:ff".
   Input parameter(s) :
     *pbuf : an Ethernet string
   Input/output parameter(s) :
     *peths : <FONT COLOR="#000088">netwib_eths</FONT> updated
   Output parameter(s) :
   Normal return values :
     <FONT COLOR="#000044">NETWIB_ERR_OK</FONT> : ok
*/</FONT>
<FONT COLOR="#000088">netwib_err</FONT> <B>netwib_eths_add_buf</B>(<FONT COLOR="#000088">netwib_eths</FONT> *peths,
                               <FONT COLOR="#000088">netwib_constbuf</FONT> *pbuf);

<FONT COLOR="#880000">/*-------------------------------------------------------------*/</FONT>
<FONT COLOR="#880000">/* Name : netwib_eths_add_kbd
   Description :
     Update a list with data entered through keyboard.
   Input parameter(s) :
     message : message to print before
    defaultlist : default list to use if user enters nothing
                  if NULL, there is no default
   Input/output parameter(s) :
   Output parameter(s) :
     *peths : <FONT COLOR="#000088">netwib_eths</FONT> updated
   Normal return values :
     <FONT COLOR="#000044">NETWIB_ERR_OK</FONT> : ok
*/</FONT>
<FONT COLOR="#000088">netwib_err</FONT> <B>netwib_eths_add_kbd</B>(<FONT COLOR="#000088">netwib_eths</FONT> *peths,
                               <FONT COLOR="#000088">netwib_constbuf</FONT> *pmessage,
                               <FONT COLOR="#000088">netwib_constbuf</FONT> *pdefaultlist);

<FONT COLOR="#880000">/*-------------------------------------------------------------*/</FONT>
<FONT COLOR="#880000">/* Name : netwib_eths_del_eth
   Description :
     Del an address to the netwib_eths.
   Input parameter(s) :
     eth : address to delete
   Input/output parameter(s) :
     *peths : <FONT COLOR="#000088">netwib_eths</FONT> where to work
   Output parameter(s) :
   Normal return values :
     <FONT COLOR="#000044">NETWIB_ERR_OK</FONT> : ok
*/</FONT>
<FONT COLOR="#000088">netwib_err</FONT> <B>netwib_eths_del_eth</B>(<FONT COLOR="#000088">netwib_eths</FONT> *peths,
                               <FONT COLOR="#000088">netwib_consteth</FONT> *peth);

<FONT COLOR="#880000">/*-------------------------------------------------------------*/</FONT>
<FONT COLOR="#880000">/* Name : netwib_eths_del_ethrange
   Description :
     Del a range of addresses to the netwib_eths.
   Input parameter(s) :
     infeth : inferior eth
     supeth : superior eth
   Input/output parameter(s) :
     *peths : <FONT COLOR="#000088">netwib_eths</FONT> where to work
   Output parameter(s) :
   Normal return values :
     <FONT COLOR="#000044">NETWIB_ERR_OK</FONT> : ok
*/</FONT>
<FONT COLOR="#000088">netwib_err</FONT> <B>netwib_eths_del_ethrange</B>(<FONT COLOR="#000088">netwib_eths</FONT> *peths,
                                    <FONT COLOR="#000088">netwib_consteth</FONT> *pinfeth,
                                    <FONT COLOR="#000088">netwib_consteth</FONT> *psupeth);

<FONT COLOR="#880000">/*-------------------------------------------------------------*/</FONT>
<FONT COLOR="#880000">/* Name : netwib_eths_del_eths
   Description :
     Remove a list of addresses to the netwib_eths.
   Input parameter(s) :
     *pethstoadd : <FONT COLOR="#000088">netwib_eths</FONT> to remove
   Input/output parameter(s) :
     *peths : <FONT COLOR="#000088">netwib_eths</FONT> where to work
   Output parameter(s) :
   Normal return values :
     <FONT COLOR="#000044">NETWIB_ERR_OK</FONT> : ok
*/</FONT>
<FONT COLOR="#000088">netwib_err</FONT> <B>netwib_eths_del_eths</B>(<FONT COLOR="#000088">netwib_eths</FONT> *peths,
                                <FONT COLOR="#000088">netwib_consteths</FONT> *pethstodel);

<FONT COLOR="#880000">/*-------------------------------------------------------------*/</FONT>
<FONT COLOR="#880000">/* Name : netwib_eths_contains_xyz
   Description :
     Check if a <FONT COLOR="#000088">netwib_eth</FONT> is in the list.
   Input parameter(s) :
     eth : <FONT COLOR="#000088">netwib_eth</FONT> to find
   Input/output parameter(s) :
     *peths : <FONT COLOR="#000088">netwib_eths</FONT> containing the list of addresses
   Output parameter(s) :
     *pyes : true if <FONT COLOR="#000088">netwib_eth</FONT> is found
   Normal return values :
     <FONT COLOR="#000044">NETWIB_ERR_OK</FONT> : ok
*/</FONT>
<FONT COLOR="#000088">netwib_err</FONT> <B>netwib_eths_contains_eth</B>(<FONT COLOR="#000088">netwib_consteths</FONT> *peths,
                                    <FONT COLOR="#000088">netwib_consteth</FONT> *peth,
                                    <FONT COLOR="#000088">netwib_bool</FONT> *pyes);
<FONT COLOR="#000088">netwib_err</FONT> <B>netwib_eths_contains_ethrange</B>(<FONT COLOR="#000088">netwib_consteths</FONT> *peths,
                                         <FONT COLOR="#000088">netwib_consteth</FONT> *pinfeth,
                                         <FONT COLOR="#000088">netwib_consteth</FONT> *psupeth,
                                         <FONT COLOR="#000088">netwib_bool</FONT> *pyes);

<FONT COLOR="#880000">/*-------------------------------------------------------------*/</FONT>
<FONT COLOR="#880000">/* Name : netwib_buf_append_eths
   Description :
     Append a string representing a netwib_eths.
   Input parameter(s) :
     *peths : <FONT COLOR="#000088">netwib_eths</FONT> to append
   Input/output parameter(s) :
     pbuf : buffer updated
   Output parameter(s) :
   Normal return values :
     <FONT COLOR="#000044">NETWIB_ERR_OK</FONT> : ok
*/</FONT>
<FONT COLOR="#000088">netwib_err</FONT> <B>netwib_buf_append_eths</B>(<FONT COLOR="#000088">netwib_consteths</FONT> *peths,
                                  <FONT COLOR="#000088">netwib_buf</FONT> *pbuf);
</PRE><BR><BR><HR><BR>
<H2><A HREF="../../index.html">main index</A></H2>
<H2><A HREF="../net.html">section index</A></H2>
</BODY></HTML>
